package o;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import java.io.File;
import java.io.FileNotFoundException;
import o.sg.d;

public final class vl implements vk<Uri, File> {
    private final Context ˋ;

    public static final class a implements vr<Uri, File> {
        private final Context ॱ;

        public a(Context context) {
            this.ॱ = context;
        }

        @NonNull
        public vk<Uri, File> ˏ(vo voVar) {
            return new vl(this.ॱ);
        }

        public void ॱ() {
        }
    }

    static class c implements sg<File> {
        private static final String[] ˎ = new String[]{"_data"};
        private final Context ˏ;
        private final Uri ॱ;

        c(Context context, Uri uri) {
            this.ˏ = context;
            this.ॱ = uri;
        }

        public void ˏ(@NonNull rl rlVar, @NonNull d<? super File> dVar) {
            Object obj = null;
            Cursor query = this.ˏ.getContentResolver().query(this.ॱ, ˎ, null, null, null);
            if (query != null) {
                try {
                    if (query.moveToFirst()) {
                        obj = query.getString(query.getColumnIndexOrThrow("_data"));
                    }
                    query.close();
                } catch (Throwable th) {
                    query.close();
                }
            }
            if (TextUtils.isEmpty(obj)) {
                dVar.ˏ(new FileNotFoundException("Failed to find file path for: " + this.ॱ));
            } else {
                dVar.ॱ(new File(obj));
            }
        }

        public void ˏ() {
        }

        public void ॱ() {
        }

        @NonNull
        public Class<File> ˋ() {
            return File.class;
        }

        @NonNull
        public rz ˎ() {
            return rz.LOCAL;
        }
    }

    public /* synthetic */ boolean ˋ(@NonNull Object obj) {
        return ˊ((Uri) obj);
    }

    public /* synthetic */ o.vk.c ˎ(@NonNull Object obj, int i, int i2, @NonNull sc scVar) {
        return ॱ((Uri) obj, i, i2, scVar);
    }

    public vl(Context context) {
        this.ˋ = context;
    }

    public o.vk.c<File> ॱ(@NonNull Uri uri, int i, int i2, @NonNull sc scVar) {
        return new o.vk.c(new aai(uri), new c(this.ˋ, uri));
    }

    public boolean ˊ(@NonNull Uri uri) {
        return sx.ˊ(uri);
    }
}
